package com.sofwin.yyb.service.impl;

import com.sofwin.yyb.dao.MechanismDao;
import com.sofwin.yyb.dto.MechanismDto;
import com.sofwin.yyb.entity.Mechanism;
import com.sofwin.yyb.entity.Course;
import com.sofwin.yyb.service.MechanismService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service("merchantService")
public class MechanismServiceImpl implements MechanismService {

    @Autowired
    MechanismDao mechanismDao;

    @Override
    public void addMerchant(Mechanism mechanism) {
        mechanismDao.insert(mechanism);
    }

    @Override
    public Mechanism findByUserId(Integer userid) {
        Mechanism mechanism = mechanismDao.selectByUserId(userid);
        return mechanism;
    }

    @Override
    public List<Course> findServiceList(Map<String, Object> map) {
        List<Course> list = mechanismDao.selectServiceList(map);
        return list;
    }

    @Override
    public List<MechanismDto> findAllMechanism(Map<String, Object> map) {
        return mechanismDao.selectAllMechanism(map);
    }

    @Override
    public Integer mechanismCount(String search) {
        return mechanismDao.selectMechanismCount(search);
    }
}
